package com.smec;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @ClassName pojo.DataThreeListener
 * @Description TODO
 * @Author u3431
 * @Date 2021/8/11 14:53
 * @Version 1.0
 */
public class DataOneListener extends AnalysisEventListener<Map<Integer, String>>  {
    List<DataInput> list = new ArrayList<>();

    @Override
    public void invoke(Map<Integer, String> data , AnalysisContext analysisContext) {
        DataInput dataDetail = DataInput.builder()
                .id(Long.parseLong(data.get(0)))
                .val(Float.parseFloat(data.get(1)))
                .build();
        list.add(dataDetail);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
    public List<DataInput> getData(){
        return list;
    }
}

